package cn.ddiancan.xddcloud.psc.oss;

import cn.ddiancan.xddcloud.psc.oss.config.XddCloudOssProperties;
import cn.ddiancan.xddcloud.psc.oss.config.XddcloudSmsProperties;
import com.aliyun.oss.OSSClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(basePackages = "cn.ddiancan.xddcloud.psc.oss")
@EnableConfigurationProperties({XddCloudOssProperties.class, XddcloudSmsProperties.class})
public class XddcloudOssConfiguration {

    @Bean
    public OSSClient s3Client(XddCloudOssProperties properties) {
        return new OSSClient(properties.getEndpoint(), properties.getAccessKeyId(), properties.getAccessKeySecret());
    }
}
